<%--
  Created by IntelliJ IDEA.
  User: XMY
  Date: 2019-02-22
  Time: 10:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="author" content="order by dede58.com"/>
    <title>小米商城-个人中心</title>
    <link rel="stylesheet" type="text/css" href="./css/style.css">
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<!-- start header -->
<header>
    <div class="top center">
        <div class="left fl">
            <ul>
                <li><a href="index.jsp">小米商城</a></li>
                <li>|</li>
                <li><a href="">MIUI</a></li>
                <li>|</li>
                <li><a href="">米聊</a></li>
                <li>|</li>
                <li><a href="">游戏</a></li>
                <li>|</li>
                <li><a href="">多看阅读</a></li>
                <li>|</li>
                <li><a href="">云服务</a></li>
                <li>|</li>
                <li><a href="">金融</a></li>
                <li>|</li>
                <li><a href="">小米商城移动版</a></li>
                <li>|</li>
                <li><a href="">问题反馈</a></li>
                <li>|</li>
                <li><a href="">Select Region</a></li>
                <div class="clear"></div>
            </ul>
        </div>
        <div class="right fr">
            <div class="gouwuche fr"><a href="./dingdanzhongxin.html">我的订单</a></div>
            <div class="fr">
                <ul>
                    <c:if test="${user!=null}">
                        <ul>
                            <li>${user.uname}</li>
                            <li><a href="loginServlet?method=logout">注销</a></li>
                            <li><a href="">个人中心</a></li>
                            <li><a href="">我的订单</a></li>
                        </ul>
                    </c:if>
                    <c:if test="${user==null}">
                        <%
                            response.sendRedirect("login.jsp");
                        %>
                    </c:if>
                </ul>
            </div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </div>
</header>
<!--end header -->
<!-- start banner_x -->
<div class="banner_x center">
    <a href="./index.html" target="_blank"><div class="logo fl"></div></a>
    <a href=""><div class="ad_top fl"></div></a>
    <div class="nav fl">
        <ul>
            <li><a href="">小米手机</a></li>
            <li><a href="">红米</a></li>
            <li><a href="">平板·笔记本</a></li>
            <li><a href="">电视</a></li>
            <li><a href="">盒子·影音</a></li>
            <li><a href="">路由器</a></li>
            <li><a href="">智能硬件</a></li>
            <li><a href="">服务</a></li>
            <li><a href="">社区</a></li>
        </ul>
    </div>
    <div class="search fr">
        <form action="" method="post">
            <div class="text fl">
                <input type="text" class="shuru"  placeholder="小米6&nbsp;小米MIX现货">
            </div>
            <div class="submit fl">
                <input type="submit" class="sousuo" value="搜索"/>
            </div>
            <div class="clear"></div>
        </form>
        <div class="clear"></div>
    </div>
</div>
<!-- end banner_x -->
<!-- self_info -->
<div class="grzxbj">
    <div class="selfinfo center">
        <div class="lfnav fl">
            <div class="ddzx">订单中心</div>
            <div class="subddzx">
                <ul>
                    <li><a href="./dingdanzhongxin.html" >我的订单</a></li>
                    <li><a href="">意外保</a></li>
                    <li><a href="">团购订单</a></li>
                    <li><a href="">评价晒单</a></li>
                </ul>
            </div>
            <div class="ddzx">个人中心</div>
            <div class="subddzx">
                <ul>
                    <li><a href="./self_info.html" style="color:#ff6700;font-weight:bold;">我的个人中心</a></li>
                    <li><a href="">消息通知</a></li>
                    <li><a href="">收货地址</a></li>
                    <li><a href="updatePwd.jsp">修改密码</a></li>
                </ul>
            </div>
        </div>
        <div class="rtcont fr">
            <div class="grzlbt ml40">我的资料</div>
            <div class="subgrzl ml40"><span>昵称</span><span>${user.nickName}</span><span><a href="javascript:void (0)" class="edit" uid="${user.id}" column="nickname">编辑</a></span></div>
            <div class="subgrzl ml40"><span>手机号</span><span>${user.phone}</span><span><a href="javascript:void (0)" class="edit" uid="${user.id}" column="phone">编辑</a></span></div>
            <div class="subgrzl ml40"><span>个性签名</span><span>${user.signature}</span><span><a href="javascript:void (0)" class="edit" uid="${user.id}" column="signature">编辑</a></span></div>
            <div class="subgrzl ml40"><span>我的爱好</span><span>${user.hobby}</span><span><a href="javascript:void (0)" class="edit" uid="${user.id}" column="hobby">编辑</a></span></div>
            <div class="subgrzl ml40"><span>收货地址</span><span>${user.address}</span><span><a href="javascript:void (0)" class="edit" uid="${user.id}" column="address">编辑</a></span></div>

        </div>
        <div class="clear"></div>
    </div>
</div>
<!-- self_info -->

<footer class="mt20 center">
    <div class="mt20">小米商城|MIUI|米聊|多看书城|小米路由器|视频电话|小米天猫店|小米淘宝直营店|小米网盟|小米移动|隐私政策|Select Region</div>
    <div>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号</div>
    <div>违法和不良信息举报电话：185-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</div>
</footer>

<script type="text/javascript" src="js/jquery-3.3.1.js"></script>
<script type="text/javascript">
    $(function () {
        $(".edit").bind("click",function () {
            var index = $(".edit").index(this);
            if ($(".edit").eq(index).html()=="编辑"){//当文本值是编辑时
                $(".edit").eq(index).html("保存");//修改按钮为保存
                var thisVal = $(".edit").eq(index).parent().prev().html();//获取用户信息
                $(".edit").eq(index).parent().prev().html("<input type='text' value='"+thisVal+"'>");//添加一个input文本框
            } else {
                $(".edit").eq(index).html("编辑");
                var thisVal = $(".edit").eq(index).parent().prev().children().val();
                $(".edit").eq(index).parent().prev().html(thisVal);
                var uid = $(this).attr("uid");
                var column = $(this).attr("column");
                $.post("userInfoServlet","method=updateInfo&id="+uid+"&column="+column+"&updateValue="+thisVal,function (date) {
                    if (date>0){
                        alert("修改成功！");
                    }
                })
            }
        })
    })


</script>
</body>
</html>
